<template>
    <div class="box">
        <div class="top">
            <img :src="sellerArr.avatar" alt="">
            <div>
                <p>{{ sellerArr.name }}</p>
                <p>蜂鸟专送/38分钟送达</p>
                <p>在线支付满28减5，满50减10</p>
            </div>
        </div>
        <div class="nav">
            <ul class="navName">
                <li>
                    <router-link to="/">商品</router-link>
                </li>
                <li>
                    <router-link to="/pingjia">评价</router-link>
                </li>
                <li>
                    <router-link to="/shangjia">商家</router-link>
                </li>
            </ul>
        </div>
        <div class="content">
            <RouterView></RouterView>
        </div>
        <div class="bottom">
            <div>
                <div class="cart iconfont icon-gouwuche" @click="showMask = !showMask">
                    <!-- <div class="mask" v-show="showMask">
                        <p class="carTitle">
                             <span>购物车</span>
                             <span>清空</span>
                        </p>
                        <ul class="type">
                            <li v-for="item in carGoods">
                                <p>{{item}}</p>
                                <p>
                                <span>￥10</span>
                                <span @click="num--">-</span>
                                <span>{{num}}</span>
                                <span @click="num++">+</span>
                                </p>
                                
                            </li>
                        </ul>
                    </div> -->
                </div>
                <p class="money">￥0</p>
            </div>
            <div>另需配送费￥4元</div>
            <div>￥20起送</div>
        </div>
        <div class="mask" v-show="showMask">
            <div class="carTop"></div>
            <p class="carTitle">
                <span>购物车</span>
                <span>清空</span>
            </p>
            <ul class="type">
                <li v-for="item in carGoods">
                    <p>{{ item }}</p>
                    <p>
                        <span>￥10</span>
                        <span @click="num--">-</span>
                        <span>{{ num }}</span>
                        <span @click="num++">+</span>
                    </p>

                </li>
            </ul>
        </div>
    </div>
</template>

<script>
import axios from "axios";
export default {
    data() {
        return {
            sellerArr: [],
            carGoods: ['莲子核桃黑米粥', '小米粥', '皮蛋廋肉粥', '蔬菜粥', '白米粥','莲子核桃黑米粥', '小米粥', '皮蛋廋肉粥', '蔬菜粥', '白米粥'],
            showMask: true,
            num: 1
        };
    },
    created() {
        this.getData();
    },
    methods: {
        async getData() {
            const data = await axios.get('http://localhost:3009/goods');
            this.sellerArr = data.data.seller;
            console.log(this.sellerArr);
        },
    }
}
</script>

<style scoped>
* {
    margin: 0;
    padding: 0;
}

ul,
ol,
li {
    list-style: none;
}

a,
a:active,
a:hover {
    text-decoration: none;
    color: gray;
}

.box {
    width: 1000px;
    height: 2000px;
    margin: 0 auto;
    position: relative;
}

.top {
    height: 200px;
    background-color: pink;
    display: flex;
    justify-content: center;
    background: url('../img/beijing.jpeg') no-repeat;
    align-items: center;
}

.top>div {
    width: 400px;
    height: 180px;
    color: white;
}

.top>div>p {
    margin-bottom: 35px;
}

.top>div>p:nth-child(1) {
    font-size: 36px;
}

.top>div>p:nth-child(2) {
    font-size: 26px;
}

.top>div>p:nth-child(3) {
    font-size: 18px;
}

.top>div>p:nth-child(1)::before {
    content: "品牌";
    color: white;
    background: red;
    font-size: 24px;
    border-radius: 5px;
    margin-right: 10px;
    padding: 2px 5px;

}

.top>div>p:nth-child(3)::before {
    content: '减';
    background: white;
    color: red;
    margin-right: 10px;
    padding: 0px 3px;

}

img {
    display: block;
    width: 180px;
    height: 180px;
    margin-right: 20px;
}

.navName {
    height: 50px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    font-size: 28px;
    border-bottom: 1px solid gray;
}

.bottom {
    width: 1000px;
    height: 80px;
    background: #000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: gray;
    position: relative;
    z-index: 2;
}

.bottom>div {
    display: flex;
    flex: 1;
    border-right: 1px solid gray;
    text-align: center;
    line-height: 80px;
    justify-content: center;
    font-size: 22px;
}

.mask {
    /* width: 1000px; */
    height: 900px;
    top: 0;
    left: 0;
    background: white;
    position: absolute;
    z-index: 1;
    display: flex;
    flex-direction: column;
}
.mask>.carTop{
    height: 350px;
    background: url('../img/beijing.jpeg') no-repeat;
}

.bottom>div:last-child {
    border-right: none;
}

.bottom>div:nth-child(3) {
    background-color: gainsboro;
}

.cart{
    display: inline-block;
    width: 80px;
    height: 80px;
    background: #000;
    border-radius: 50%;
    position: absolute;
    top: -25px;
    font-size: 40px;
}
.mask>.carTitle {
    height: 80px;
    line-height: 80px;
    padding: 0px 20px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid gray;
    background: gainsboro;
    font-size: 24px;
}

.mask>.carTitle>span:nth-child(2) {
    color: blue;
}

.mask>.type {
    flex-direction: column;
    flex: 1;
    font-size: 20px;
    display: flex;
    align-items: flex-start;
    overflow: auto;
}

::-webkit-scrollbar {
    display: none;
}

.mask>.type>li {
    width: 1000px;
    height: 200px;
    border-bottom: 1px solid gainsboro;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 18px;
    color: #000;
}

.mask>.type>li>p:nth-child(2)>span {
    margin-right: 18px;
    font-size: 20px;
}

.mask>.type>li>p:nth-child(2)>span:nth-child(1) {
    color: red;
    font-weight: bold;
}

.mask>.type>li>p:nth-child(2)>span:nth-child(2) {
    padding: 0px 8px;
    background: blue;
    border-radius: 50%;
    color: white;
    font-weight: bold;
}

.mask>.type>li>p:nth-child(2)>span:nth-child(4) {
    padding: 0px 6px;
    background: blue;
    border-radius: 50%;
    color: white;
    font-weight: bold;
}

.content {
    width: 1000px;
    height: 600px;
}

.pp1 {
    background: aqua;
    text-align: center;
    padding: 0px 20px;
    display: flex;
    justify-content: space-between;
    font-size: 18px;
}

.money {
    margin-left: 200px;
}

.carUl {
    font-size: 14px;
}
</style>